using System.Collections.Generic;
using System.Drawing;
using SkaldRogueLike.Main.DungeonGenerating.DirectionProcessing;

namespace SkaldRogueLike.Main.DungeonGenerating.MapImplementations
{
    public sealed class Room : Map
    {
        public Dictionary<Dir, bool> Doors { get; set; }

        public Room(int width, int height) : base(width, height)
        {
            InitializeCells();
            Doors = new Dictionary<Dir, bool>
                        {
                            {Dir.North, false},
                            {Dir.East, false},
                            {Dir.South, false},
                            {Dir.West, false}
                        };
        }

        protected override void InitializeCells()
        {
            foreach (var p in CellLocations)
            {
                var cell = new DungeonCell();
                cell.SetSide(Dir.North, p.Y == 0 ? Side.Wall : Side.Empty);
                cell.SetSide(Dir.South, p.Y == Height - 1 ? Side.Wall : Side.Empty);
                cell.SetSide(Dir.West, p.X == 0 ? Side.Wall : Side.Empty);
                cell.SetSide(Dir.East, p.X == Width - 1 ? Side.Wall : Side.Empty);
                DungeonCells[p.X, p.Y] = cell;
            }
        }

        public void Move(Point point)
        {
            _bounds = new Rectangle(point, _bounds.Size);
        }
    }
}